#!/bin/bash
dir=${PWD}
builddir="$dir/build"
[ -d "$builddir" ] || mkdir -p "$builddir"

xelatex_opts+=" -synctex=1"
xelatex_opts+=" -interaction=nonstopmode"
xelatex_opts+=" -output-directory=build"

echo -e "\n------------------ xelatex --------------------\n"
xelatex $xelatex_opts $1
ln -sf build/*.log
mv build/*.pdf $dir
